//package com.example.demo.netty;
//
//import io.netty.bootstrap.Bootstrap;
//import io.netty.channel.Channel;
//import io.netty.channel.ChannelInitializer;
//import io.netty.channel.nio.NioEventLoopGroup;
//import io.netty.channel.socket.nio.NioSocketChannel;
//import io.netty.handler.codec.string.StringEncoder;
//
//import java.net.InetSocketAddress;
//
//public class HelloNettyClientTest1 {
//    public static void main(String[] args) throws InterruptedException {
//        Channel channel = new Bootstrap()
//                .group(new NioEventLoopGroup())
//                .channel(NioSocketChannel.class)
//                .handler(new ChannelInitializer<NioSocketChannel>() {
//                    @Override
//                    protected void initChannel(NioSocketChannel nioSocketChannel) throws Exception {
//                        nioSocketChannel.pipeline().addLast(new StringEncoder());
//                    }
//                })
//                .connect(new InetSocketAddress("localhost", 8082))
//                .sync()
//                .channel();
//        channel.writeAndFlush("hello world");
//        System.out.println("你好");
//    }
//}
